/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.nb.jobs.properties.editors;

import com.google.common.collect.ImmutableList;
import commons.nb.data.gui.properties.editors.Builder_ExPE;
import commons.nb.data.gui.properties.editors.Builder_ExPE_IFactory;
import commons.nb.jobs.properties.BuilderProperty;
import commons.nb.jobs.properties.editors.ComboBoxPropertyEditor;
import commons.nb.jobs.properties.editors.List_ComboIE;
import commons.nb.jobs.properties.editors.List_ExPE_IFactory;
import commons.util.Converters;
import genomemap.data.AssignmentData;
import genomemap.data.KSA00Data;
import genomemap.data.OrganismData;
import genomemap.data.TAB08Data;
import org.openide.explorer.propertysheet.InplaceEditor;

import java.util.Objects;

/**
 * Collection of property  editors in tracker.
 *
 * @author Susanta Tewari
 * @version 1.0.0
 * @history Created on Jun 15, 2012.
 * @since 1.0.0
 */
public final class PropertyEditors_Gen {

    /**
     * Private constructor to disable instantiation.
     */
    private PropertyEditors_Gen() {}

    /**
     * Property editor for KC64Data Options.
     */
    public static class AlignMap_CREATE_DISPLAY extends ComboBoxPropertyEditor {

        public AlignMap_CREATE_DISPLAY() {

            super(new String[] { "Create", "Display" }, new String[] { "alignmap-create",
                    "alignmap-display" });
        }
    }

    /**
     * Property editor that creates a combo box of available {@code AssignmentData} builders for
     * property {@link commons.nb.jobs.properties.BuilderProperty}.
     */
    public static class Builder_Data_AssignmentData_ExPE_IFactory
            extends Builder_ExPE_IFactory<AssignmentData> {

        public Builder_Data_AssignmentData_ExPE_IFactory() {
            super(AssignmentData.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_AssignmentData_ExPE.class;
        }
    }

    public static class Builder_Data_AssignmentData_ExPE extends Builder_ExPE<AssignmentData> {

        public Builder_Data_AssignmentData_ExPE() {
            super(AssignmentData.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_AssignmentData_ExPE_IFactory.class;
        }
    }

    /**
     * Property editor for contig map type.
     */
    public static class ConfigMapType extends ComboBoxPropertyEditor {

        public ConfigMapType() {

            super(new String[] { "Full Contig Map", "Minimal Contig Map" }, new String[] { "FULL",
                    "MINIMAL" });
        }
    }

    /**
     * Property editor for KSa00 likelihood algorithms.
     */
    public static class Algo_LHood_KSA00 extends ComboBoxPropertyEditor {

        public Algo_LHood_KSA00() {
            super(new String[] { "Default" }, new String[] { "ksa00:1" });
        }
    }

    /**
     * Property editor that creates a combo box of available {@code KSA00Data} builders for property
     * {@link commons.nb.jobs.properties.BuilderProperty}.
     */
    public static class Builder_Data_KSA00Data_ExPE_IFactory
            extends Builder_ExPE_IFactory<KSA00Data> {

        public Builder_Data_KSA00Data_ExPE_IFactory() {
            super(KSA00Data.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_KSA00Data_ExPE.class;
        }
    }

    public static class Builder_Data_KSA00Data_ExPE extends Builder_ExPE<KSA00Data> {

        public Builder_Data_KSA00Data_ExPE() {
            super(KSA00Data.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_KSA00Data_ExPE_IFactory.class;
        }
    }

    /**
     * Property editor for KSA00 data simulators.
     */
    public static class Simulator_Data_KSA00Data extends ComboBoxPropertyEditor {

        public Simulator_Data_KSA00Data() {
            super(new String[] { "Default" }, new String[] { "ksa00data:1" });
        }
    }

    /**
     * Property editor for TAB08 estimators..
     */
    public static class Estimator_KSA00 extends ComboBoxPropertyEditor {

        public Estimator_KSA00() {

            super(new String[] { "Conjugate Gradient" },
                  new String[] { "ksa00estimator:conj-gradient" });
        }
    }

    /**
     * Property editor for KSA00 model generators.
     */
    public static class Generator_Model_KSA00 extends ComboBoxPropertyEditor {

        public Generator_Model_KSA00() {
            super(new String[] { "Random Probe Permutations" }, new String[] { "ksa00:1" });
        }
    }

    /**
     * Property editor that creates a combo box of available {@code OrganismData} builders for
     * property {@link commons.nb.jobs.properties.BuilderProperty}.
     */
    public static class Builder_Data_OrganismData_ExPE_IFactory
            extends Builder_ExPE_IFactory<OrganismData> {

        public Builder_Data_OrganismData_ExPE_IFactory() {
            super(OrganismData.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_OrganismData_ExPE.class;
        }
    }

    public static class Builder_Data_OrganismData_ExPE extends Builder_ExPE<OrganismData> {

        public Builder_Data_OrganismData_ExPE() {
            super(OrganismData.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_OrganismData_ExPE_IFactory.class;
        }
    }

    /**
     * Property editor for TAB08 likelihood algorithms.
     */
    public static class Algo_LHood_TAB08 extends ComboBoxPropertyEditor {

        public Algo_LHood_TAB08() {

            super(new String[] { "Straightforward Algorithm", "Recursive Linking Algorithm" },
                  new String[] { "tab08:sfa",
                                 "tab08:rla" });
        }
    }

    /**
     * Property editor that creates a combo box of available {@code TAB08Data} builders for property
     * {@link commons.nb.jobs.properties.BuilderProperty}.
     */
    public static class Builder_Data_TAB08Data_ExPE_IFactory
            extends Builder_ExPE_IFactory<TAB08Data> {

        public Builder_Data_TAB08Data_ExPE_IFactory() {
            super(TAB08Data.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_TAB08Data_ExPE.class;
        }
    }

    public static class Builder_Data_TAB08Data_ExPE extends Builder_ExPE<TAB08Data> {

        public Builder_Data_TAB08Data_ExPE() {
            super(TAB08Data.class);
        }

        @Override
        public Class getAlternativePE() {
            return Builder_Data_TAB08Data_ExPE_IFactory.class;
        }
    }

    /**
     * Property editor for TAB08 estimators..
     */
    public static class Estimator_TAB08 extends ComboBoxPropertyEditor {

        public Estimator_TAB08() {
            super(new String[] { "Interval MLE" }, new String[] { "tab08:interval-mle" });
        }
    }

    /**
     * Property editor for KSA00 model generators.
     */
    public static class Simulator_Data_TAB08Data extends ComboBoxPropertyEditor {

        public Simulator_Data_TAB08Data() {
            super(new String[] { "Default" }, new String[] { "tab08data:1" });
        }
    }

    /**
     * Property editor for KSA00 model generators.
     */
    public static class Generator_Model_TAB08 extends ComboBoxPropertyEditor {

        public Generator_Model_TAB08() {
            super(new String[] { "Random Gene Permutations" }, new String[] { "tab08:1" });
        }
    }

    public static class TAB08_GeneOrder_PE extends List_ExPE_IFactory<String> {

        @Override
        protected InplaceEditor buildInplace(Object va) {

            Objects.requireNonNull(va);

            BuilderProperty prop              = (BuilderProperty) va;
            final TAB08Data tab08Data         = (TAB08Data) prop.getValue().build();
            final ImmutableList<String> genes = tab08Data.getModel().getGenes();
            final List_ComboIE<String> comboIE = new List_ComboIE<>(genes,
                                                     Converters.<String>of_toString());

            return comboIE;
        }
    }
}
